function createFirstMenu(title, path, component, icon) {
    return {
        "redirect": null,
        "path": path,
        "component": component,
        "route": "1",
        "meta": {
            "keepAlive": false,
            "internalOrExternal": false,
            "icon": icon || "home",
            "componentName": "Analysis",
            "title": title
        },
        "name": path,
        "id": Date.parse(new Date)
    }
}

function createSecondaryMenuPage(name, path, component) {
    return {
        "path": path,
        "component": component,
        "route": "1",
        "meta": {
            "keepAlive": false,
            "internalOrExternal": false,
            "componentName": "Index",
            "title": name
        },
        "name": path,
        "id": "d86f58e7ab516d3bc6bfb1fe10585f97"
    }
}

function createSecondMenu(firstMenuName, secondMenuNames, icon) {
    const children = secondMenuNames.map(item => {
        const name = item.name
        const path = item.path
        const component = item.component
        return createSecondaryMenuPage(name, path, component)
    })
    return {
        "redirect": null,
        "path": "/projects",
        "component": "layouts/RouteView",
        "route": "1",
        "children": children,
        "meta": {
            "keepAlive": false,
            "internalOrExternal": false,
            "icon": icon || "user",
            "componentName": "RouteView",
            "title": firstMenuName
        },
        "name": "account",
        "id": "717f6bee46f44a3897eca9abd6e2ec44"
    }
}

function createPage(title, path, component) {
    const data = {
        "path": path,
        "component": component,
        "route": "1",
        "meta": {
            "keepAlive": false,
            "internalOrExternal": false,
            "componentName": "Index",
            "title": title
        },
        "name": path,
        "id": "d86f58e7ab516d3bc6bfb1fe10585f97"
    }
    return data
}

module.exports = {
    createFirstMenu,
    createSecondMenu,
    createPage
}